import { request } from "@/utils/service"

/** 登录并返回 Token */
export function loginApi(data) {
  return request({
    url: "/backend/api/auth/login",
    method: "post",
    data
  })
}
export function registerApi(data) {
  return request({
    url: "/backend/api/auth/register",
    method: "post",
    data
  })
}

/** 获取用户详情 */
export function getUserInfoApi() {
  return request({
    url: "/backend/api/user/me",
    method: "get"
  })
}
// 用户列表
export function getUserList(data) {
  return request({
    url: "/backend/user/list",
    method: "post",
    data
  })
}
// 启用用户
export function enableUser(data) {
  return request({
    url: "/backend/user/enable",
    method: "post",
    data
  })
}
// 停用用户
export function disableUser(data) {
  return request({
    url: "/backend/user/disable",
    method: "post",
    data
  })
}
// 增加角色
export function addRole(data) {
  return request({
    url: "/backend/userRole/addRoles",
    method: "post",
    data
  })
}
// 重置密码
export function resetPwd(data) {
  return request({
    url: "/backend/user/resetPassword",
    method: "post",
    data
  })
}
// 修改自己的密码
export function changePwd(data) {
  return request({
    url: "/backend/api/user/changePassword",
    method: "post",
    data
  })
}
